package com.itheima.web.servlet;

import com.itheima.dao.DepartmentsDao;
import com.itheima.entity.Departments;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class DepServlet {
    @Autowired private DepartmentsDao departmentsDao;
    @RequestMapping(value = "/departments",method = RequestMethod.GET)
    @ResponseBody
    public List<Departments> getdepartments(){
        List<Departments> list = departmentsDao.findAllDepartments();
        return list;
    }
}
